package com.xuanyue.componentdemo.controller;


import com.xuanyue.componentauth.exception.ExceptionHandle;
import com.xuanyue.componentbasics.result.Result;
import com.xuanyue.componentdemo.entity.po.UserInfo;
import com.xuanyue.componentdemo.server.TestAuthServer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test/auth")
public class TestAuthController {

    @Resource
    private TestAuthServer testAuthServer;

    @Resource
    private ExceptionHandle exceptionHandle;

    @GetMapping("/getToken")
    public String getToken(){

        return testAuthServer.login();

    };

    @GetMapping("/getUser")
    public Result<UserInfo> getUser(){
        return Result.success( testAuthServer.getUser() );
    }


}
